package wxshop.web.admin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import wxshop.api.admin.model.FormResult;
import wxshop.service.admin.impl.SysManageServiceImpl;

@RestController
@RequestMapping("/admin/sysmanage")
public class SysManageController {
    @Autowired
    private SysManageServiceImpl sysManageService;
    @RequestMapping(value = "/sysmember",method = RequestMethod.GET)
    public FormResult sysmember(){
        return sysManageService.selectAllAdmin();
    }

    @RequestMapping(value="/selectAccess",method = RequestMethod.GET)
    public FormResult selectAccess(){
        return  sysManageService.selectAccessList();
    }
    @RequestMapping(value = "/updateaccess",method = RequestMethod.POST)
    public FormResult updateaccess(int id,int roleid){
        return sysManageService.updateAccessByid(id,roleid);
    }
    @RequestMapping(value = "priceRule",method = RequestMethod.GET)
    public FormResult priceRule(){

        return sysManageService.selectPriceRules();
    }
    @RequestMapping(value = "/levelUp")
    public FormResult levelUp(){
        return sysManageService.selectLevelUpRules();
    }
    @ExceptionHandler
    public FormResult onException(Exception e){
        return new FormResult(false,e.getMessage());
    }
}
